﻿@{
    Layout = "../Shared/_Default.cshtml";
    ViewBag.PageTitle = T(Res.Name("Title"));
}

@section Sidebar
{
    <section class="box">
        <header>
            <ul class="bar inlinebar">
                <li><a href="@Url.Action(Loc.Act("Index"))">x</a></li>
            </ul>
            <h3>&asymp;</h3>
        </header>
        <section>
        @{
            Html.RenderPartial("_Filter");
        }
        </section>
    </section>
    <section class="box">
        <header>
            <h3>&equiv;</h3>
        </header>
        <section>
        @{
            Html.RenderPartial("_GoTo");
        }
        </section>
    </section>
}
<section class="box">
    <script type="text/javascript">
        jQuery(document).ready(function () {
            jQuery.ajax({
                type: 'post',
                url: '@Url.Action(Loc.Act("Formats").Ctrl("ImportExport").Area("System"))',
                dataType: 'json',
                success: function (rsp) {
                    jQuery('@ID("#ddl_import_format")').empty();
                    jQuery('@ID("#ddl_export_format")').empty();
                    jQuery.each(rsp, function (k, v) {
                        jQuery('@ID("#ddl_import_format")').append('<option value=' + v.id + '>' + v.value + '</option>');
                        jQuery('@ID("#ddl_export_format")').append('<option value=' + v.id + '>' + v.value + '</option>');
                    });
                }
            });
            jQuery('@ID("#dlg_import")').dialog();
            jQuery('@ID("#btn_import")').click(function () {
                jQuery('@ID("#dlg_import")').dialog("open");
            });
            jQuery('@ID("#dlg_export")').dialog();
            jQuery('@ID("#btn_export")').click(function () {
                jQuery('@ID("#dlg_export")').dialog("open");
            });
        });
    </script>
    <header>
        <ul class="bar toolbar">
            <li><a id="@ID("btn_import")" class="button" href="#">@T(Res.In("Common").Of("Act").Name("Import"))</a></li>
            <li><a id="@ID("btn_export")" class="button" href="#">@T(Res.In("Common").Of("Act").Name("Export"))</a></li>
            <li><a class="button" href="@Url.Action(Loc.Act("Create"))">@T(Res.In("Common").Of("Act").Name("Create"))</a></li>
        </ul>
        <h3>@ViewBag.PageTitle</h3>
    </header>
    <section>
        @{
            Html.RenderPartial("_Grid");
        }
        <div id="@ID("dlg_export")">
            <form action="@Url.Action(Loc.Act("Export").Ctrl("ImportExport").Area("System"))" method="post">
                <input type="hidden" name="returnUrl" value="@Request.RawUrl" />
                <input type="hidden" name="name" value="ExportCatalogItemGroups" />
                <ul>
                    <li>
                        <select id="@ID("ddl_export_format")" name="formatID"></select>
                    </li>
                </ul>
                <ul class="bar toolbar">
                    <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
                </ul>
            </form>
        </div>
        <div id="@ID("dlg_import")">
            <form action="@Url.Action(Loc.Act("Import").Ctrl("ImportExport").Area("System"))" method="post" enctype="multipart/form-data">
                <input type="hidden" name="returnUrl" value="@Request.RawUrl" />
                <input type="hidden" name="name" value="ImportCatalogItemGroups" />
                <ul>
                    <li>
                        <select id="@ID("ddl_import_format")" name="formatID"></select>
                    </li>
                    <li>
                        <input type="file" name="file" />
                    </li>
                </ul>
                <ul class="bar toolbar">
                    <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
                </ul>
            </form>
        </div>
    </section>
</section>
